﻿<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="_Default" %>

<!DOCTYPE html>
<html>
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0, user-scalable=no">
    <title>测试APP</title>
    <link href="css/global.css" rel="stylesheet" type="text/css" />
    <link href="css/bensie.css" rel="stylesheet" type="text/css" />
    <style type="text/css">
        html, body {
            margin: 0;
            padding: 0;
        }

        .page-form {
            margin-left: auto;
            margin-right: auto;
            margin-top: 10%;
        }
    </style>
    <script src="js/jquery-last.js" type="text/javascript"></script>
    <script src="js/jquery.form.js" type="text/javascript"></script>
    <script src="js/bensie.mini.last.js" type="text/javascript"></script>
    <script src="js/SHA1.js" type="text/javascript"></script>
</head>
<body>
    <form id="form1" runat="server">
        <table class="page-form">
            <tr>
                <td></td>
                <td></td>
            </tr>
            <tr>
                <td>
                    <label>
                        <i></i>帐号：</label>
                </td>
                <td>
                    <input class="txt" name="user" placeholder="请填写帐号" />
                </td>
            </tr>
            <tr>
                <td>
                    <label>
                        <i></i>密码：</label>
                </td>
                <td>
                    <input class="txt" name="pass" placeholder="请填写密码" type="password" />
                </td>
            </tr>
            <tr>
                <td></td>
                <td>
                    <input class="btn-ok" type="button" value="测试" onclick="test()" />
                </td>
            </tr>
        </table>
    </form>
</body>
<script>
    function test() {
        var v = _Default.Test().value;
        var a = SHA1(v.sha1) + '.' + v.now;
        var filter = {
            'fields': { 'id': true, 'title': true, 'url': true, 'order': true, 'htmlType(uz*R*id)': true },
            'order': 'order ASC'
        };
        $.ajax({
            'url': 'https://d.apicloud.com/mcm/api/Html?filter=' + encodeURIComponent(JSON.stringify(filter)),
            'type': 'GET',
            'cache': false,
            'headers': {
                'X-APICloud-AppId': v.appId,
                'X-APICloud-AppKey': a
            }
        }).done(function (data, status, header) {
            //success body
            alert(data.length);
            alert(JSON.stringify(data));
        }).fail(function (header, status, errorThrown) {
            //fail body
            alert('f');
        });
    }
</script>
</html>
